package com.contory.ssn_lgnd.framework.gl;

public class TextureRegion {    
    public float u1, v1;
    public float u2, v2;
    
    public TextureRegion(int textureWidth, int textureHeight, float x, float y, float width, float height) {
        this.u1 = x / textureWidth;
        this.v1 = y / textureHeight;
        this.u2 = this.u1 + width / textureWidth;
        this.v2 = this.v1 + height / textureHeight;        
    }
    
    public TextureRegion(float u1, float v1, float u2, float v2){
    	this.u1 = u1; this.u2 = u2; this.v1 = v1; this.v2 = v2;
    }
    
    public void flipCoordY(){
    	float tmp = v2;
    	v2 = v1;
    	v1 = tmp;
    	//v2 = -v2;
    }
    
    public TextureRegion copy(){
    	return new TextureRegion(u1, v1, u2, v2);
    }
}
